from starlette.endpoints import HTTPEndpoint
from starlette.responses import JSONResponse
from model.ModAreaList import AreaList, areaListSchema



def get_area_list(session):
    #区域信息
    area_list = session.query(AreaList).all()
    return JSONResponse(areaListSchema.dump(area_list, many=True).data)

def get_area_info(session, areaid: str):
    #区域信息
    area_info = session.query(AreaList).filter(AreaList.id == areaid).one_or_none()
    return areaListSchema.dump(area_info, many=False).data
